package com.chenfan.mcn.enums;

import com.chenfan.common.extension.dict.DictTranslator;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 红人类型枚举
 * @author: xuxianbei
 * Date: 2022/5/23
 * Time: 14:41
 * Version:V1.0
 */
@Getter
@AllArgsConstructor
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum StarTypeEnum implements DictTranslator<Integer, String> {

    INSIDE(1, "内部红人"),

    OUTSIDE(2, "外部红人"),

    E_BUSINESS(3, "电商红人"),

    KOC(4, "koc红人"),
    ;

    @Getter
    private Integer code;

    @Getter
    private String desc;

    /**
     *
     * @return
     */
    public static List<Integer> getAllStarType() {
        return Stream.of(StarTypeEnum.values()).map(StarTypeEnum::getCode).collect(Collectors.toList());
    }

    public static boolean isInside(Integer starType) {
        return StarTypeEnum.INSIDE.getCode().equals(starType);
    }

    @Override
    public String translate(Integer code) {
        for(StarTypeEnum item : StarTypeEnum.values()) {
            if(item.getCode().equals(code)) {
                return item.getDesc();
            }
        }
        return null;
    }
}
